/*
{
"状态":1,
"名称":"新增-供应商资料",
"作者":"陈泽椿",
"创建时间":"2018-06-30",
"功能":"新增-供应商资料",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/
declare @supplier_no varchar(100), @supplier_name varchar(100),@phone varchar(100),@contacter varchar(100),@sup_address varchar(100),@landline varchar(100)
declare @short_name varchar(100),@fax varchar(100)

set @supplier_no = '{supplier_no}'
set @supplier_name ='{supplier_name}' 
set @short_name ='{short_name}'
set @fax ='{fax}'
set @phone ='{phone}' 
set @contacter ='{contacter}' 
set @sup_address ='{sup_address}' 
set @landline ='{landline}'   

 
--校验信息
if isnull(@supplier_no,'')=''
begin 
	RAISERROR ('SQL:供应商编号不允许为空', 16 ,1 ) ; 
	return 
end 

if isnull(@supplier_name,'')=''
begin 
	RAISERROR ('SQL:供应商名称不允许为空', 16 ,1 ) ; 
	return 
end

if EXISTS(SELECT * FROM b_supplier WHERE [supplier_no]=@supplier_no )
begin
	RAISERROR ('SQL:供应商编号已经存在', 16 ,1 ) ; 
	return 
end

INSERT INTO [dbo].[b_supplier]([supplier_no],[supplier_name],[short_name],[simple_code],[fax],[phone],[contacter],[sup_address],[landline],[create_time],[create_user],[update_time],[update_user])
VALUES( @supplier_no , @supplier_name ,@short_name,dbo.f_getpy(@short_name),@fax, @phone , @contacter , @sup_address , @landline , getdate(), 0 , getdate() , 0 )

